package com.hackerrank.challenges.tutorialintro;

import java.util.Scanner;

public class Solution {
	private static int index(int V, int ar[]) {
		int l = 0, u = ar.length - 1;
		while(l <= u) {
			int m = (l + u) / 2;
			if(V < ar[m])
				u = m - 1;
			else if(V > ar[m])
				l = m + 1;
			else
				return m;
		}
		return -1;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int V = in.nextInt(), n = in.nextInt(), ar[] = new int[n];
		for(int i = 0; i < n; i++)
			ar[i] = in.nextInt();
		System.out.println(index(V, ar));
	}
}
